package com.oa.oaspcpersonalcenterapi.api;




import com.oa.oaspccommon.dto.ActionResult;
import com.oa.oaspccommon.dto.UserInfo;
import com.oa.oaspccommon.po.User;
import com.oa.oaspcpersonalcenterapi.fallback.UserServiceApiFallback;


import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by jeffrey on 2021/4/13.
 */
@FeignClient(value = "personalcenter-service", fallback = UserServiceApiFallback.class)
public interface UserServiceApi {

    @RequestMapping(value = "/login",method = RequestMethod.POST)
    public User login(@RequestBody UserInfo userInfo);

    //    查询所有
    @RequestMapping(value = "/users", method = RequestMethod.GET)
    public List<User> findUsers();

    //    查询单个
    @RequestMapping( value = "/user/{uid}", method = RequestMethod.GET)
    public User findUserByUid(@PathVariable("uid") int uid);


    //    增加
    @RequestMapping(value = "/user", method = RequestMethod.POST)
    public boolean addUser(@RequestBody User user);

    //    修改
    @RequestMapping(value = "/user", method = RequestMethod.PUT)
    public boolean updateUser(@RequestBody User user);

    //    删除
    @RequestMapping(value = "/user", method = RequestMethod.DELETE)
    public boolean deleteUserByUid(@RequestParam(value = "uid") int uid);

    //    修改
    @RequestMapping(value = "/user", method = RequestMethod.PUT)
    public ActionResult changePassword(@RequestBody UserInfo userInfo);
}
